import request from '@/utils/request'
const BASE='/project/service-corporation'
export default {
  //删除劳务公司
  delete(serviceCorporationId){
    return request({
      url: `${BASE}/delete`,
      method: 'post',
      params:serviceCorporationId
    })
  },
  //从项目删除
  deleteFromProject(projectId,serviceCorporationId){
    return request({
      url: `${BASE}/deleteFromProject`,
      method: 'post',
      params:{
        project_id:projectId,
        service_corporation_id:serviceCorporationId
      }
    })
  },
  //根据id查劳务公司信息
  detail(serviceCorporationId){
    
    return request({
      url: `${BASE}/getCorporationNameByCorporationId`,
      method: 'get',
      params:{Service_corporation_id:serviceCorporationId}
    })
  },
  //新增劳务公司
  insert(endTime,name,notes,projectId,startTime){
    return request({
      url: `${BASE}/insert`,
      method: 'post',
      data:{
        endTime:endTime,
        name:name,
        notes:notes,
        projectId:projectId,
        startTime:startTime}
    })
  },
  //劳务公司列表
  list(){
    return request({
      url: `${BASE}/list`,
      method: 'get',
    })
  },
  //根据项目id查询劳务公司列表
  listByProjectId(data){
    return request({
      url: `${BASE}/listByProjectId`,
      method: 'get',
      params:data
    })
  },
  //根据劳务公司名称查询
  selectByName(serviceCorporationName){
    // console.log(serviceCorporationName);
    return request({
      url: `${BASE}/selectByName`,
      method: 'get',
      params:serviceCorporationName
    })
  },
  //根据项目id查询劳务公司以及劳务公司下的班组
  treeByProjectId(id){
    return request({
        url: `${BASE}/treeByProjectId`,
        method: 'get',
        params:id
    })
  },
  //修改劳务公司
  update(endTime,name,notes,projectId,serviceCorporationId,startTime){
    return request({
      url: `${BASE}/update`,
      method: 'post',
      data:{
        endTime: endTime,
        name: name,
        notes:notes,
        projectId:projectId,
        serviceCorporationId:serviceCorporationId,
        startTime:startTime
      }
    })
  }
}